﻿namespace Lr.Templating.FluentMapping
{
    /// <summary>
    /// Abstract implemention for <see cref="ITemplateMapping"/>,
    /// which defines mapping between a template's placeholder and the value to generate for the placeholder.
    /// </summary>
    internal abstract class TemplateMappingBase : ITemplateMapping
    {
        /// <summary>
        /// Constructs a new <see cref="TemplateMappingBase"/> instance.
        /// </summary>
        /// <param name="placeholder">The placeholder string.</param>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="placeholder"/> is null, empty or only exists of white spaces.</exception>
        internal TemplateMappingBase(string placeholder)
        {
            ThrowIf.NullOrEmpty(() => placeholder);

            _placeholder = placeholder;
        }

        /// <summary>
        /// Gets the placeholder.
        /// </summary>
        public string Placeholder { get { return _placeholder; } }
        private readonly string _placeholder;
    }
}
